// pages/xianyonghuquanyispliebiao/xianyonghuquanyispliebiao.js

const app = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    shangping:'',
    jif:'',
  },

  lishi(){
    wx.navigateTo({
      url: '../../pages/shangluojifenshangchengduihuanlishi/shangluojifenshangchengduihuanlishi',
   
    })
  },



  region() {
    this.setData({
      openid: app.globalData.openid,
      jiami: app.globalData.jiami,
      OPEN_ID: app.globalData.openid,
      session_key: app.globalData.session_key,
    })
    wx.request({
      url: app.globalData.interface+'/shangluo/API_8305_SelectshangluoIntegralGood',
      method: 'POST',
      data: {
        OPEN_ID: this.data.openid, //用户OPEN_ID
        session_key: this.data.session_key,
        OPEN_UUID: this.data.jiami
      },
      header: {
        'content-type': 'application/x-www-form-urlencoded'
      },
      success: res => {
        console.log(res.data.data);
        this.setData({
          shangping: res.data.data,
        })

      }
    })
  },



    //火爆单品
    exhibits(e) {
      console.log(e.currentTarget.dataset.item);
      this.setData({
        details: e.currentTarget.dataset.item
      })
  
      wx.navigateTo({
        url: '../../pages/shangluojifenshangchengduihuan/shangluojifenshangchengduihuan?data=' + JSON.stringify(this.data.details)
      })
  
    },
  



    zhuce() {
      this.setData({
        jiami: app.globalData.jiami,
        openid: app.globalData.openid,
        session_key: app.globalData.session_key,
      })
      wx.request({
        url: app.globalData.interface+'/shangluo/API_8303_SelectshangluoUserIntegral',
        method: 'POST',
        data: {
          OPEN_ID: app.globalData.openid, //用户OPEN_ID
          session_key: app.globalData.session_key,
          OPEN_UUID: app.globalData.jiami,
  
        },
        header: {
          'content-type': 'application/x-www-form-urlencoded'
        },
        success: res => {



          this.setData({
            jif: res.data.data.INTEGRAL,
          })

          
        }
      })
    },




  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(e) {

    console.log(e);

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */


  onShow() {
    setTimeout(() => {
      this.setData({
        openid: app.globalData.openid,
        jiami: app.globalData.jiami,
        OPEN_ID: app.globalData.openid,
        session_key: app.globalData.session_key,
      })
      this.region()
      this.zhuce()
    }, 1000);


  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

  }
})